const addSC = Vue.extend({
    props:[''],//父组件传值放入点
    data(){
        return{
            ruleForm: {
                content: '',
                optiona:'',
                optionb:'',
                optionc:'',
                optiond:'',
                answer:'',
                creator:'',
                answerDetail:'',
                labelId:'',
                bankId:''
            },
            labelOptions:[],
            bankOptions:[],
            rules: {
                content: [
                    { required: true, message: '请填写题目内容', trigger: 'blur' }
                ],
                answerDetail: [
                    { required: true, message: '请填写选项内容', trigger: 'blur' }
                ],

            },
            storage:'',
            token:'',
            refreshToken:''
        }
    },
    mounted(){
        this.storage=window.localStorage;
        this.token=this.storage.getItem("token");
        this.refreshToken=this.storage.getItem("refreshToken");
        axios.get("/label/all",{
            headers:{
                "token":this.token,
                "refreshToken":this. refreshToken
            }
        }).then(res=>{
            this.labelOptions=res.data;
        }),
        axios.get("/qb/all",{
            headers:{
                "token":this.token,
                "refreshToken":this.refreshToken
            }
        }).then(res=>{
            this.bankOptions=res.data
        })
    },
    methods:{
        onSubmit(){
            let SingleChoice = JSON.parse(JSON.stringify(this.ruleForm));
            axios.post("/sc/add",SingleChoice,
                {
                    headers:{
                        'Content-Type':'application/json;charset=UTF-8',
                        "token":this.token,
                        "refreshToken":this. refreshToken
                    }
                }).then(res=>{
                    if(res.code==200){
                        alert("成功")
                    }
                    this.ruleForm={};
            })

        }
    },
    template:`
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form-item label="题目内容" prop="content" >
                <el-input type="textarea" v-model="ruleForm.content" style="width: 500px"></el-input>
             </el-form-item>

            <el-form-item label="选项A" >
               <el-input v-model="ruleForm.optiona" style="width: 400px"></el-input>
             <el-radio v-model="ruleForm.answer" label="A">设为答案</el-radio>
            </el-form-item>
               
            <el-form-item label="选项B" >
               <el-input v-model="ruleForm.optionb" style="width: 400px"></el-input>
               <el-radio v-model="ruleForm.answer" label="B">设为答案</el-radio>
            </el-form-item>
         
            <el-form-item label="选项C" >
               <el-input v-model="ruleForm.optionc" style="width: 400px"></el-input>
              <el-radio v-model="ruleForm.answer" label="C">设为答案</el-radio>
            </el-form-item>
    
            <el-form-item label="选项D"  >
               <el-input v-model="ruleForm.optiond" style="width: 400px"></el-input>
             <el-radio v-model="ruleForm.answer" label="D">设为答案</el-radio>
            </el-form-item>
  
            <el-form-item label="答案解析" prop="answerDetail" >
                <el-input type="textarea" v-model="ruleForm.answerDetail" style="width: 500px"></el-input>
            </el-form-item>
            
            <el-form-item label="创建人" prop="creator" >
                <el-input type="input" v-model="ruleForm.creator" style="width: 100px"></el-input>
            </el-form-item>
            
            <el-form-item label="标签" prop="label">
                <el-select v-model="ruleForm.labelId" placeholder="请选择标签">
                    <el-option
                      v-for="item in labelOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="题库" prop="bank">
                <el-select v-model="ruleForm.bankId" placeholder="请选择题库">
                    <el-option
                      v-for="item in bankOptions"
                      :key="item.id"
                      :label="item.label"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
             <el-form-item size="large">
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button>取消</el-button>
             </el-form-item>
            
         </el-form>
        `
    })

const addMC = Vue.extend({
    props:[''],//父组件传值放入点
    data(){
        return{
            ruleForm: {
                content: '',
                optiona:'',
                optionb:'',
                optionc:'',
                optiond:'',
                answerArray:[],
                answerDetail:'',
                labelId:'',
                bankId: ''
            },
            labelOptions:[],
            bankOptions:[],
            rules: {
                content: [
                    { required: true, message: '请填写题目内容', trigger: 'blur' }
                ],
                answerDetail: [
                    { required: true, message: '请填写选项内容', trigger: 'blur' }
                ],

            },
            storage:'',
            token:'',
            refreshToken:''
        }
    },
    mounted(){
        this.storage=window.localStorage;
        this.token=this.storage.getItem("token");
        this.refreshToken=this.storage.getItem("refreshToken");
        axios.get("/label/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this. refreshToken
            }
        }).then(res=>{
            this.labelOptions=res.data;
        }),
        axios.get("/qb/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this.refreshToken
            }
        }).then(res=>{
            this.bankOptions=res.data
        })
    },
    methods:{
        onSubmit(){
            let MultipleChoice = JSON.parse(JSON.stringify(this.ruleForm));
            axios.post("/mc/add",MultipleChoice,{
                headers:{
                    'Content-Type':'application/json;charset=UTF-8',
                    "token":this.token,
                    "refreshToken":this.refreshToken
                }
            }).then(res=>{
                if(res.code==200){
                    alert("success");
                }
                this.ruleForm={}
            })
        }
    },
    template:`
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form-item label="题目内容" prop="content" >
                <el-input type="textarea" v-model="ruleForm.content" style="width: 500px"></el-input>
             </el-form-item>

            <el-form-item label="选项A" >
                <el-input v-model="ruleForm.optiona" style="width: 400px"></el-input>
                <el-checkbox v-model="ruleForm.answerArray" label="A">设为答案</el-checkbox>
            </el-form-item>
               
            <el-form-item label="选项B" >
               <el-input v-model="ruleForm.optionb" style="width: 400px"></el-input>
               <el-checkbox v-model="ruleForm.answerArray" label="B">设为答案</el-checkbox>
            </el-form-item>
         
            <el-form-item label="选项C" >
               <el-input v-model="ruleForm.optionc" style="width: 400px"></el-input>
              <el-checkbox v-model="ruleForm.answerArray" label="C">设为答案</el-checkbox>
            </el-form-item>
    
            <el-form-item label="选项D"  >
               <el-input v-model="ruleForm.optiond" style="width: 400px"></el-input>
               <el-checkbox v-model="ruleForm.answerArray" label="D">设为答案</el-checkbox>
            </el-form-item>
  
            <el-form-item label="答案解析" prop="answerDetail" >
                <el-input type="textarea" v-model="ruleForm.answerDetail" style="width: 500px"></el-input>
            </el-form-item>
            
            <el-form-item label="创建人" prop="creator" >
                <el-input type="input" v-model="ruleForm.creator" style="width: 100px"></el-input>
            </el-form-item>
            
            <el-form-item label="标签" prop="label">
                <el-select v-model="ruleForm.labelId" placeholder="请选择活动标签">
                    <el-option
                      v-for="item in labelOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="题库" prop="bank">
                <el-select v-model="ruleForm.bankId" placeholder="请选择题库">
                    <el-option
                      v-for="item in bankOptions"
                      :key="item.id"
                      :label="item.label"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
             <el-form-item size="large">
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button>取消</el-button>
             </el-form-item>
         </el-form>
        `
    })

const addTOF = Vue.extend({
    props:[''],//父组件传值放入点
    data(){
        return{
            ruleForm: {
                content: '',
                answer:'',
                answerDetail:'',
                labelId:'',
                bankId: ''
            },
            labelOptions:[],
            bankOptions:[],
            rules: {
                content: [
                    { required: true, message: '请填写题目内容', trigger: 'blur' }
                ],
                answerDetail: [
                    { required: true, message: '请填写选项内容', trigger: 'blur' }
                ],

            },
            storage:'',
            token:'',
            refreshToken:''
        }
    },
    mounted(){
        this.storage=window.localStorage;
        this.token=this.storage.getItem("token");
        this.refreshToken=this.storage.getItem("refreshToken");
        axios.get("/label/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this. refreshToken
            }
        }).then(res=>{
            this.labelOptions=res.data;
        }),
        axios.get("/qb/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this.refreshToken
            }
        }).then(res=>{
            this.bankOptions=res.data
        })
    },
    methods:{
        onSubmit(){
            let TrueOrFalse = JSON.parse(JSON.stringify(this.ruleForm));
            axios.post("/sc/add",TrueOrFalse,{
                headers:{
                    'Content-Type':'application/json;charset=UTF-8',
                    "token":this.token,
                    "refreshToken":this.refreshToken
                }
            }).then(res=>{
                if(res.code==200){
                    alert("success");
                }
                this.ruleForm={}

            })

        }
    },
    template:`
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form-item label="题目内容" prop="content" >
                <el-input type="textarea" v-model="ruleForm.content" style="width: 500px"></el-input>
             </el-form-item>
            <el-form-item>
               <el-radio v-model="ruleForm.answer" label="1">对</el-radio>
               <el-radio v-model="ruleForm.answer" label="0">错</el-radio>
            </el-form-item>
            <el-form-item label="答案解析" prop="answerDetail" >
                <el-input type="textarea" v-model="ruleForm.answerDetail" style="width: 500px"></el-input>
            </el-form-item>
            
            <el-form-item label="创建人" prop="creator" >
                <el-input type="input" v-model="ruleForm.creator" style="width: 100px"></el-input>
            </el-form-item>
            
            <el-form-item label="标签" prop="label">
                <el-select v-model="ruleForm.label" placeholder="请选择活动区域">
                    <el-option
                      v-for="item in labelOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="题库" prop="bank">
                <el-select v-model="ruleForm.bankId" placeholder="请选择题库">
                    <el-option
                      v-for="item in bankOptions"
                      :key="item.id"
                      :label="item.label"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
             <el-form-item size="large">
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button>取消</el-button>
             </el-form-item>
            
         </el-form>
        `
    })

const addBF = Vue.extend({
    props:[''],//父组件传值放入点
    data(){
        return{
            ruleForm: {
                content: '',
                numOfBlank:'',
                answer:'',
                answerDetail:'',
                labelId:'',
                bankId: ''
            },
            labelOptions:[],
            bankOptions:[],
            rules: {
                content: [
                    { required: true, message: '请填写题目内容', trigger: 'blur' }
                ],
                answerDetail: [
                    { required: true, message: '请填写选项内容', trigger: 'blur' }
                ],

            },
            storage:'',
            token:'',
            refreshToken:''
        }
    },
    mounted(){
        this.storage=window.localStorage;
        this.token=this.storage.getItem("token");
        this.refreshToken=this.storage.getItem("refreshToken");
        axios.get("/label/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this. refreshToken
            }
        }).then(res=>{
            this.labelOptions=res.data;
        }),
        axios.get("/qb/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this.refreshToken
            }
        }).then(res=>{
            this.bankOptions=res.data
        })
    },
    methods:{
        onSubmit(){
            let BlankFilling = JSON.parse(JSON.stringify(this.ruleForm));
            axios.post("/sc/add",BlankFilling,{
                headers:{
                    'Content-Type':'application/json;charset=UTF-8',
                    "token":this.token,
                    "refreshToken":this. refreshToken
                }
            }).then(res=>{
                if(res.code==200){
                    alert("success");
                }
                this.ruleForm={}
            })

        }
    },
    template:`
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form-item label="题目内容" prop="content" >
                <el-input type="textarea" v-model="ruleForm.content" style="width: 500px"></el-input>
             </el-form-item>
            <el-form-item label="空格数量">
                <el-input type="input" v-model="ruleForm.numOfBlank" style="width: 200px"></el-input>
            </el-form-item>
            <el-form-item label="答案解析" prop="answerDetail" >
                <el-input type="textarea" v-model="ruleForm.answerDetail" style="width: 500px"></el-input>
            </el-form-item>
            
            <el-form-item label="创建人" prop="creator" >
                <el-input type="input" v-model="ruleForm.creator" style="width: 100px"></el-input>
            </el-form-item>
            
            <el-form-item label="标签" prop="label">
                <el-select v-model="ruleForm.label" placeholder="请选择活动区域">
                    <el-option
                      v-for="item in labelOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="题库" prop="bank">
                <el-select v-model="ruleForm.bankId" placeholder="请选择题库">
                    <el-option
                      v-for="item in bankOptions"
                      :key="item.id"
                      :label="item.label"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
             <el-form-item size="large">
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button>取消</el-button>
             </el-form-item>
            
         </el-form>
        `
    })

const addSA = Vue.extend({
    props:[''],//父组件传值放入点
    data(){
        return{
            ruleForm: {
                content: '',
                answer:'',
                answerDetail:'',
                labelId:'',
                bankId: ''
            },
            labelOptions:[],
            bankOptions:[],
            rules: {
                content: [
                    { required: true, message: '请填写题目内容', trigger: 'blur' }
                ],
                answerDetail: [
                    { required: true, message: '请填写选项内容', trigger: 'blur' }
                ],

            },
            storage:'',
            token:'',
            refreshToken:''
        }
    },
    mounted(){
        this.storage=window.localStorage;
        this.token=this.storage.getItem("token");
        this.refreshToken=this.storage.getItem("refreshToken");
        axios.get("/label/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this. refreshToken
            }
        }).then(res=>{
            this.labelOptions=res.data;
        }),
        axios.get("/qb/all",{
            headers:{
                'Content-Type':'application/json;charset=UTF-8',
                "token":this.token,
                "refreshToken":this.refreshToken
            }
        }).then(res=>{
            this.bankOptions=res.data
        })
    },
    methods:{
        onSubmit(){
            let ShortAnswer = JSON.parse(JSON.stringify(this.ruleForm));
            axios.post("/sc/add",ShortAnswer,{
                headers:{
                    'Content-Type':'application/json;charset=UTF-8',
                    "token":this.token,
                    "refreshToken":this.refreshToken
                }
            }).then(res=>{
                if(res.code==200){
                    alert("success");
                }
                this.ruleForm={}
            })

        }
    },
    template:`
         <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form-item label="题目内容" prop="content" >
                <el-input type="textarea" v-model="ruleForm.content" style="width: 500px"></el-input>
             </el-form-item>
            <el-form-item label="答案解析" prop="answerDetail" >
                <el-input type="textarea" v-model="ruleForm.answerDetail" style="width: 500px"></el-input>
            </el-form-item>
            
            <el-form-item label="创建人" prop="creator" >
                <el-input type="input" v-model="ruleForm.creator" style="width: 100px"></el-input>
            </el-form-item>
            
            <el-form-item label="标签" prop="label">
                <el-select v-model="ruleForm.label" placeholder="请选择活动区域">
                    <el-option
                      v-for="item in labelOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="题库" prop="bank">
                <el-select v-model="ruleForm.bankId" placeholder="请选择题库">
                    <el-option
                      v-for="item in bankOptions"
                      :key="item.id"
                      :label="item.label"
                      :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
             <el-form-item size="large">
                <el-button type="primary" @click="onSubmit">立即创建</el-button>
                <el-button>取消</el-button>
             </el-form-item>
            
         </el-form>
        `
    })
